#!/usr/bin/env node
import { readFile } from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
import { dirname, join } from 'node:path';
import { sanitizeChromeInteractiveElementsResult } from '../src/lib/interactive-elements.js';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

async function main() {
  try {
    const inputPath = join(__dirname, 'select.json');
    const raw = await readFile(inputPath, 'utf8');
    const parsed = JSON.parse(raw);
    const sanitized = sanitizeChromeInteractiveElementsResult(parsed);
    console.log(JSON.stringify(sanitized, null, 2));
  } catch (error) {
    console.error('[sanitize-test] 处理失败:', error);
    process.exitCode = 1;
  }
}

main();

